/*
 * OREKIT-X
 * Copyright 2002-2008 CS Communication & Systemes
 * 
 * Parts of this software package have been licensed to CS
 * Communication & Systemes (CS) under one or more contributor license
 * agreements.  See the NOTICE file distributed with this work for
 * additional information.
 *  
 * This is an experimental copy of OREKIT from www.orekit.org.
 * Please use the original OREKIT from orekit.org for normal work
 * unrelated to this research project.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You
 * may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.  See the License for the specific language governing
 * permissions and limitations under the License.
 */
package ore.orbits;

import ore.Frame;
import ore.Orbit;
import ore.PositionVelocity;
import ore.errors.OrekitException;
import ore.time.AbsoluteDate;

/**
 * The parameters used internally are the cartesian coordinates:
 *   <ul>
 *     <li>x</li>
 *     <li>y</li>
 *     <li>z</li>
 *     <li>xDot</li>
 *     <li>yDot</li>
 *     <li>zDot</li>
 *   </ul>
 * contained in {@link PositionVelocity}.
 * 
 * Note that the implementation of this class delegates all
 * non-cartesian related computations ({@link #getA()}, {@link
 * #getEquinoctialEx()}, ...) to an underlying instance of the {@link
 * EquinoctialOrbit} class. Using this class only for computation
 * exclusively in non-cartesian parameters is possible but
 * sub-optimal.
 * 
 * An instance of this class is immutable.
 * 
 * @see    ore.Orbit
 * @see    KeplerianOrbit
 * @see    CircularOrbit
 * @see    EquinoctialOrbit
 * 
 * @author Luc Maisonobe
 * @author Guylaine Prat
 * @author Fabien Maussion
 * @author V&eacute;ronique Pommier-Maurussane
 */
public class CartesianOrbit 
    extends ore.Orbit
{

    public final EquinoctialOrbit equinoctial;


    /** 
     * @param pvCoordinates Position and velocity of the satellite.
     * @param frame Frame in which position is defined
     * @param date Date at which position is defined
     * @param mu Central attraction coefficient (m<sup>3</sup>/s<sup>2</sup>)
     */
    public CartesianOrbit(PositionVelocity pvCoordinates, Frame frame, AbsoluteDate date, double mu){
        super(pvCoordinates, frame, date, mu);
        this.equinoctial = new EquinoctialOrbit(pvCoordinates, frame, date, mu);
    }
    /** 
     * @param op orbital parameters to copy
     */
    public CartesianOrbit(Orbit op){
        super(op);
        this.equinoctial = new EquinoctialOrbit(op);
    }


    /** 
     * @return Semi-major axis (m)
     */
    public double getA() {
        return this.equinoctial.getA();
    }
    /** 
     * @return Eccentricity
     */
    public double getE() {
        return this.equinoctial.getE();
    }
    /** 
     * @return Inclination (rad)
     */
    public double getI() {
        return this.equinoctial.getI();
    }
    /** 
     * @return First component of the eccentricity vector
     */
    public double getEquinoctialEx() {
        return this.equinoctial.getEquinoctialEx();
    }
    /** 
     * @return Second component of the eccentricity vector
     */
    public double getEquinoctialEy() {
        return this.equinoctial.getEquinoctialEy();
    }
    /** 
     * @return First component of the inclination vector.
     */
    public double getHx() {
        return this.equinoctial.getHx();
    }
    /** 
     * @return Second component of the inclination vector.
     */
    public double getHy() {
        return this.equinoctial.getHy();
    }
    /** 
     * @return True latitude argument (rad)
     */
    public double getLv() {
        return this.equinoctial.getLv();
    }
    /** 
     * @return Eccentric latitude argument (rad)
     */
    public double getLE() {
        return this.equinoctial.getLE();
    }
    /** 
     * @return Mean latitude argument (rad)
     */
    public double getLM() {
        return this.equinoctial.getLM();
    }
    public String toString() {
        return "cartesian parameters: " + this.getPositionVelocity().toString();
    }
}
